import React, {useEffect, useState} from 'react';
import Editor from "for-editor";
import axios from "axios";
let MarkDownView = props=>{
    let {mdContent} = props;
    //纯展示，不做编辑

    let [viewMdContent,setViewMdContent] = useState('');
    useEffect(()=>{
        axios.get(mdContent,{}).then(resp=>{
            setViewMdContent(resp.data);
        });
    },[]);
    return (
        <Editor
            style={{height:'100%',width:'100%'}}
            value={viewMdContent}
            preview={true}
            toolbar = {{
                h1: false, // h1
                h2: false, // h2
                h3: false, // h3
                h4: false, // h4
                img: false, // 图片
                link: false, // 链接
                code: false, // 代码块
                preview: false, // 预览
                expand: false, // 全屏
                /* v0.0.9 */
                undo: false, // 撤销
                redo: false, // 重做
                save: false, // 保存
                /* v0.2.3 */
                subfield: false, // 单双栏模式
            }}
        />
    );
};
MarkDownView.defaultProps = {
    mdContent:''
};
export default MarkDownView;